package util

import "time"

/**
与当前日期相比，差diff天的time.Time
*/
func TodayDiff(diff int) time.Time {
	var today time.Time
	now := time.Now()
	return time.Date(now.Year(), now.Month(), now.Day()-diff, 0, 0, 0, 0, today.Location())
}

/**
与特定日期相比，差diff天的time.Time
*/
func TimeDiff(_time time.Time, diff int) time.Time {
	return time.Date(_time.Year(), _time.Month(), _time.Day()-diff, 0, 0, 0, 0, _time.Location())
}

/**
当前日期，以0时0分0秒补齐
*/
func Today() time.Time {
	now := time.Now()
	return time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
}
